From 01333bb3f33da6b2c51e910c0fe74637a8c8e24e Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Thu, 2 Feb 2023 23:26:34 -0800 Subject: move invoices, combine profile and dashboard --- src/routes/(app)/invoice/[hash]/+layout.server.js | 19 ------------------- 1 file changed, 19 deletions(-) delete mode 100644 src/routes/(app)/invoice/[hash]/+layout.server.js (limited to 'src/routes/(app)/invoice/[hash]/+layout.server.js') diff --git a/src/routes/(app)/invoice/[hash]/+layout.server.js b/src/routes/(app)/invoice/[hash]/+layout.server.js deleted file mode 100644 index d38f945f..00000000 --- a/src/routes/(app)/invoice/[hash]/+layout.server.js +++ /dev/null @@ -1,19 +0,0 @@ -import Qr from 'qrcode-base64'; -import { get } from '$lib/utils'; -import { redirect } from '@sveltejs/kit'; - -export async function load({ depends, params, url }) { - depends('app:invoice'); - - let { hash } = params; - let invoice = await get(`/invoice/${hash}`); - let { amount, received } = invoice; - amount = parseInt(amount); - - let paid = (!amount && received) || (amount > 0 && received >= amount); - if (paid && !url.pathname.endsWith('paid')) throw redirect(307, `/invoice/${hash}/paid`); - - let sm = Qr.drawImg(invoice.text, { size: 300 }); - - return { hash, invoice, sm, lg: sm }; -} -- cgit v1.2.3